[#ftl]
import {[#list types as type][#if type_index!=0],[/#if]${type}[/#list]} from "./types";
/**
 * 返回结果
 */
export interface DataResult<ENTITY>{
    next:(e:ENTITY) => void;
    error:(err:any) => void;
    complete:()=>void;
}
/**
 * 分页对象
 */

    [#if moreTypes?size gt 0]
export interface PageInfo{
    page: number;
    size: number;
    offset: number;
    endCursor:string;
    hasNextPage:boolean;
}
[/#if]
    [#list moreTypes as t]
export interface ${t}Edge{
    node:${t};
}
export interface ${t}Connection{
    uuid:string;
    edges:${t}Edge[];
    totalCount:number;
    status:boolean;
    pageInfo:PageInfo;
}
[/#list]

/**
 * 查寻接口
 */
export interface Query {
    [#list queries as query]
    /**
     * ${query.comment}
     */
    ${query.name} ([#list query.arguments as arg][#if arg_index!=0],[/#if]${arg.name}[#if !arg.required]?[/#if]:${getTsType(arg.type)}[#if arg.list][][/#if]/*${arg.comment}*/[/#list]): [#if query.queryMode.name()=='OFFSET']DataResult<${query.type}Connection>[#else]DataResult<${getTsType(query.type)}[#if query.list][][/#if]>[/#if];
    [/#list]
}

/**
 * 更新接口
 */
export interface Mutation {
    [#list mutations as mutation]
    /**
     * ${mutation.comment}
     */
    ${mutation.name}([#list mutation.arguments as arg]${arg.name}[#if !arg.required]?[/#if]:${getTsType(arg.type)}[#if arg.list][][/#if]/*${arg.comment}*/[/#list]):DataResult<${getTsType(mutation.type)}>[#if mutation.list][][/#if]
     [/#list]
}
